package com.wantup.bootuserservice.service;

import com.alibaba.dubbo.config.annotation.Service;
import common.bean.UserAddress;
import common.service.UserService;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 服务的提供者
 *
 * @author Zhaoluowei
 * @version 1.0
 * @date 2019/4/11 9:11
 *
 * 1.要将服务的提供者注册进dubbo中。
 *  1).导入dubbo依赖 操作zookeeper的客户端(curator)
 *  2).配置服务提供者
 *
 *
 */
@Service
//@Component
public class UserProvider implements UserService {

    public List<UserAddress> getUserAddressByUserId(String s) {
        System.out.println("有人调用我");
        System.out.println("getUserAddressByUserId --> "+s);

        UserAddress userAddress1 = new UserAddress(1, "北京市丰台区", "1", "我擦擦", "1234567890", "1");
        UserAddress userAddress2 = new UserAddress(2, "北京市丰台区", "1", "我擦擦", "1234567890", "1");
        UserAddress userAddress3 = new UserAddress(3, "北京市丰台区", "1", "我擦擦", "1234567890", "1");
        UserAddress userAddress4 = new UserAddress(4, "北京市丰台区", "1", "我擦擦", "1234567890", "1");
        UserAddress userAddress5 = new UserAddress(5, "北京市丰台区", "1", "我擦擦", "1234567890", "1");
        List<UserAddress> userAddresses = new ArrayList<UserAddress>();
        userAddresses.clear();
        userAddresses.add(userAddress1);
        userAddresses.add(userAddress2);
        userAddresses.add(userAddress3);
        userAddresses.add(userAddress4);
        userAddresses.add(userAddress5);

        return userAddresses;
    }
}
